Skip to content

[MAINT] Add pre commit hooks#94

Open
ndgrigorian wants to merge 6 commits intofeature/add-numpy-random-interfacefrom
add-pre-commit-hooks
Open

[MAINT] Add pre commit hooks#94
ndgrigorian wants to merge 6 commits intofeature/add-numpy-random-interfacefrom
add-pre-commit-hooks

Conversation

@ndgrigorian
Copy link
Collaborator

@ndgrigorian ndgrigorian commented Feb 26, 2026

This PR adds pre-commit hooks to the project, following similar work last year in mkl_fft

Also updates to conform with new linters (including cython-lint), adds a pre-commit check workflow, and adds changes to .git-blame-ignore-revs

Closes #61

@ndgrigorian ndgrigorian changed the base branch from master to feature/add-numpy-random-interface February 26, 2026 09:20
@ndgrigorian ndgrigorian force-pushed the add-pre-commit-hooks branch 2 times, most recently from 321ba3b to f9cfa6e Compare February 26, 2026 21:20
@ndgrigorian ndgrigorian marked this pull request as draft February 26, 2026 22:08
@ndgrigorian
Copy link
Collaborator Author

these changes have (by some twisted miracle) introduced build failures—but only on Windows. I will have to undo and find the root cause of this.

@ndgrigorian ndgrigorian marked this pull request as ready for review February 27, 2026 00:48
@ndgrigorian ndgrigorian marked this pull request as draft February 27, 2026 01:00
@ndgrigorian
Copy link
Collaborator Author

these changes have (by some twisted miracle) introduced build failures—but only on Windows. I will have to undo and find the root cause of this.

seems clang-format caused it, likely order of includes. I will exclude include blocks from clang-formatting

@ndgrigorian ndgrigorian force-pushed the add-pre-commit-hooks branch 3 times, most recently from 715bb4f to e5b5825 Compare February 27, 2026 03:52
@ndgrigorian ndgrigorian marked this pull request as ready for review February 27, 2026 03:52
@ndgrigorian ndgrigorian force-pushed the add-pre-commit-hooks branch 3 times, most recently from ce639f1 to ec87861 Compare February 27, 2026 18:52
@ndgrigorian ndgrigorian force-pushed the feature/add-numpy-random-interface branch from e612350 to 5ffbb5a Compare February 27, 2026 19:25
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think to extend with more ones, like dpnp has:

    hooks:
    # Git
    -   id: check-added-large-files
    -   id: no-commit-to-branch
        name: "ensure no direct commit to master/maintenance branches"
        args: [--branch, "master", --pattern, "maintenance/.*"]
    -   id: check-case-conflict
    -   id: check-illegal-windows-names
    # Contents
    -   id: check-ast
    -   id: check-builtin-literals
    -   id: check-case-conflict
    -   id: check-executables-have-shebangs
    -   id: check-merge-conflict
    -   id: check-shebang-scripts-are-executable
    -   id: check-symlinks
    -   id: check-toml
    -   id: debug-statements
    -   id: destroyed-symlinks
    -   id: end-of-file-fixer
    -   id: fix-byte-order-marker
    -   id: mixed-line-ending
    -   id: trailing-whitespace

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a bad idea, one thing I'm also considering is moving as much linting as possible across all of the projects to ruff

numpy uses it, and it could replace black, flake8, and isort at once, maybe one or two others

But this isn't necessarily incompatible with that, so I can add these

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it'd be great to move to the ruff in the future.

"--errors-only",
"--disable=import-error",
]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is about?

-   repo: https://github.com/gitleaks/gitleaks
    rev: v8.30.0
    hooks:
    -   id: gitleaks

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and for GH actions:

-   repo: https://github.com/rhysd/actionlint
    rev: v1.7.11
    hooks:
    -   id: actionlint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants